################################################################################
## MOD Title:		easyUCP
## MOD Author:		AmigaLink < webmaster@amigalink.de > (Markus Schmidt) http://www.EssenMitFreude.info
##                      Angepasst an das Orion von Helrunar http://www.Runenmagie.com
##
## MOD Description:	Add a Control Panel to the userprofile without delete the original usercp funktions.
##			You can easy add own mods
## MOD Version:		1.2.0 
## 
## Compatibility:	Tested only on Orion 2.4.3
## Installation Level:	Difficult
## Installation Time:	25- 30 Minutes 
## Files To Edit:  	10
##			profile.php
##
##			admin/admin_users.php
##
##			includes/page_header.php
##			includes/usercp_avatar.php
##			includes/usercp_register.php
##			includes/usercp_viewprofile.php
##
##			templates/cback/profile_add_body.tpl
##			admin/style/user_edit_body.tpl
##
##			language/lang_english/lang_main.php
##			language/lang_german/lang_main.php
##
## Included Files:	3
##			includes/usercp_signature.php
##
##			templates/cback/easyucp_body.tpl
##			templates/cback/profile_signature.tpl
##
################################################################################
## The following sites also contain the latest version of this MOD: 
## 
## http://www.AmigaLink.de
## http://www.phpBBhacks.com
## http://www.phpBB.de
## 
## Full support for this MOD can be obtained at: 
##
## http://www.AmigaLink.de
##  
################################################################################
## Mod Notes:
##
##	This Mod contains the Signature Editor/Preview Deluxe Mod by EGO2000
##	with any changes by me! If you allready uses this Mod, please look at
##	the additional notes and relace the Modfiles with these of this Package!!!
##	Did you have installed an other Signature Editor, please reinstall it
##	before installing the easyUCP!!!
##
##	Besides this Mod contains a modified version of View Profile Sig 1.1.1
##	by netclectic < adrian@netclectic.com > (Adrian Cockbutn) http://www.netclectic.com !
##
## Author Notes:
##
##	Some Add on Mods are stored in the addons directory.
##	For more Add Ons visit http://www.AmigaLink.de
##
## Special Thanks to:
##
##	OXPUS < webmaster@oxpus.de > http://www.oxpus.de - for brainstorming!
##	Bootenks http://www.yami-unlimited.de - for the basic designidea of the profileview!
## 
################################################################################
## MOD History: 
## 
##   2005-07-25 - Version 1.2.0
##	- a security change
##	- last visit added
##	- last post added
##	- display usergroups added
##	- preperation to future extensions
##
##   2005-02-18 - Version 1.1.6 (unreleased)
##	- some bugfixes
##	- some little optical changes
##	- work with phpBB 2.0.11 and above
##
##   2004-09-11 - Version 1.1.1
##	- phpBB plus 1.5x installation Guide added
##
##   2004-08-31 - Version 1.1.1
##	- Fixed a little bug in the lang_main.php part of the installation Guide
##
##   2004-08-29 - Version 1.1.0
##	- First release
##	- User selectable Guests-Profileview-permission added
##
##   2004-08-28 - Version 1.0.3 rc
##	- one little bugfix by OXPUS
##	- one little stylefix by OXPUS
##
##   2004-08-25 - Version 1.0.0
##	- First Version
## 
################################################################################
##
##  This hack is released under the GPL License. 
##  This hack can be freely used, but not distributed, without permission.
##  Intellectual Property Rights are retained by the hack author(s) 
##  listed above.
##
################################################################################
##
##  BEFORE ADDING THIS HACK TO YOUR FORUM, please be sure to backup ALL
##  affected files.
##
################################################################################ 

#
#----------[ RUN SQL ]----------------------------------
#
#  Run the following SQL statement to update your phpBB database.
#  You can use phpMyAdmin or a similar tool to run this update.
#
#  IMPORTANT: If you have changed the table prefix from the default of phpBB2,
#  please be sure to replace phpBB2 with your prefix BEFORE running this update.
#

ALTER TABLE orion_users ADD user_allow_viewprofile tinyint( 1 ) default '1';

#
#-----[ COPY ]--------------------------------------------------
#
#  Copy / upload the following files to your phpBB root directory.
#  The Orion root directory is the directory on your server containing index.php

copy includes/usercp_signature.php to includes/usercp_signature.php 

copy templates/cback/easyucp_body.tpl to templates/cback/easyucp_body.tpl
copy templates/cback/profile_signature.tpl to templates/cback/profile_signature.tpl 

#
#-----[ OPEN ]--------------------------------------------------
#

profile.php

#
#-----[ FIND ]--------------------------------------------------
#

if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
	$mode = htmlspecialchars($mode);

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
	$ucp_mode = '';

	if ( $HTTP_POST_VARS['ucp_require'] )
	{
		$ucp_mode = 'ucp_require';
	}
	if ( $HTTP_POST_VARS['ucp_info'] )
	{
		$ucp_mode = 'ucp_info';
	}
	if ( $HTTP_POST_VARS['ucp_prefs'] )
	{
		$ucp_mode = 'ucp_prefs';
	}
	if ( $HTTP_POST_VARS['ucp_avatar'] )
	{
		$ucp_mode = 'ucp_avatar';
	}
	if ( $HTTP_POST_VARS['ucp_signature'] )
	{
//		$ucp_mode = 'ucp_signature';
		$mode = 'signature';
	}
// <!-- END easyUCP -->



#
#-----[ FIND ]--------------------------------------------------
#

redirect(append_sid("index.$phpEx", true));

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//redirect(append_sid("index.$phpEx", true));
redirect(append_sid("profile.php?mode=viewprofile&u=" . $userdata['user_id']));
// <!-- END easyUCP -->

#
#----------[ OPEN ]-------------------------------------
#

admin/admin_users.php

#
#----------[ FIND ]-------------------------------------
#

		$allowviewonline = ( isset( $HTTP_POST_VARS['hideonline']) ) ? ( ( $HTTP_POST_VARS['hideonline'] ) ? 0 : TRUE ) : TRUE;

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
		$allowviewprofile = ( isset($HTTP_POST_VARS['hideprofile']) ) ? ( ($HTTP_POST_VARS['hideprofile']) ? 0 : TRUE ) : TRUE;
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

			$sql = "UPDATE " . USERS_TABLE . "

#
#----------[ INLINE FIND ]------------------------------
#

, user_allow_viewonline = $allowviewonline

#
#----------[ INLINE AFTER, ADD ]------------------------
#

, user_allow_viewprofile = $allowviewprofile

#
#----------[ FIND ]-------------------------------------
#

		$allowviewonline = $this_userdata['user_allow_viewonline'];

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
		$allowviewprofile = $userdata['user_allow_viewprofile'];
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

			$s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />';

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
			$s_hidden_fields .= '<input type="hidden" name="hideprofile" value="' . !$allowviewprofile . '" />';
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

			'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',

#
#----------[ AFTER, ADD ]------------------------------
#

// <!-- BEGIN easyUCP -->
			'HIDE_PROFILE_YES' => ( !$allowviewprofile ) ? 'checked="checked"' : '',
			'HIDE_PROFILE_NO' => ( $allowviewprofile ) ? 'checked="checked"' : '',
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

			'L_HIDE_USER' => $lang['Hide_user'],

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
			'L_HIDE_PROFILE' => $lang['Hide_profile'],
// <!-- END easyUCP -->

#
#-----[ OPEN ]--------------------------------------------------
#

includes/page_header.php

#
#-----[ FIND ]--------------------------------------------------
#

	'U_PROFILE' => append_sid('orioncp.'.$phpEx.'?mode=editprofile'),

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//	'U_PROFILE' => append_sid('orioncp.'.$phpEx.'?mode=editprofile'),
	'U_PROFILE' => append_sid('profile.'.$phpEx),
// <!-- END easyUCP -->

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/usercp_avatar.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

   global $board_config, $db, $template, $lang, $images, $theme; 

# 
#-----[ IN-LINE FIND ]---------------------------------- 
# 

, $theme 

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------- 
# 

, $ucp_mode 

# 
#-----[ FIND ]------------------------------------------ 
# 

   $params = array('coppa', 'user_id', 
# 
#-----[ IN-LINE FIND ]---------------------------------- 
# 

, 'dateformat' 

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------- 
# 

, 'ucp_mode' 

#
#-----[ OPEN ]--------------------------------------------------
#

includes/usercp_register.php

#
#-----[ FIND ]--------------------------------------------------
#

//
// Check and initialize some variables if needed
//

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
if ( isset($HTTP_POST_VARS['ucp_cancel']) )
{
	redirect(append_sid('profile.'.$phpEx, true));
}
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');

#
#----------[ REPLACE WITH ]-----------------------------
#

// <!-- BEGIN easyUCP -->
//	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature');
	$trim_var_list = array('cur_password' => 'cur_password', 'new_password' => 'new_password', 'password_confirm' => 'password_confirm', 'signature' => 'signature', 'ucp_mode' => 'ucp_mode');
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

	$allowviewonline = ( isset($HTTP_POST_VARS['hideonline']) ) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : TRUE ) : TRUE;

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
	$allowviewprofile = ( isset($HTTP_POST_VARS['hideprofile']) ) ? ( ($HTTP_POST_VARS['hideprofile']) ? 0 : TRUE ) : TRUE;
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $realname_sql . $passwd_sql . "user_email = '" .
				

#
#----------[ BEFORE, ADD ]------------------------------
#

// <!-- BEGIN easyUCP -->
			if ( isset($HTTP_GET_VARS['ucp_mode']) || isset($HTTP_POST_VARS['ucp_mode']) )
			{
				$ucp_mode = ( isset($HTTP_GET_VARS['ucp_mode']) ) ? $HTTP_GET_VARS['ucp_mode'] : $HTTP_POST_VARS['ucp_mode'];
				$ucp_mode = htmlspecialchars($ucp_mode);
			} 
/*

#
#----------[ FIND ]-------------------------------------
#

			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			}

#
#----------[ AFTER, ADD ]-------------------------------
#

*/
// Registration Info
			if ( $ucp_mode == 'ucp_require' || $ucp_mode == '' )
			{
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_active = $user_active, user_actkey = '" . str_replace("\'", "''", $user_actkey) . "'
				WHERE user_id = $user_id";
			  if ( !($result = $db->sql_query($sql)) )
			  {
				  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			  }
			}
// Profile Info
			if ( $ucp_mode == 'ucp_info' || $ucp_mode == '' )
			{
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_from_flag = '$user_flag', user_interests = '" . str_replace("\'", "''", $interests) . "',user_aim = '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "'
				WHERE user_id = $user_id";
			  if ( !($result = $db->sql_query($sql)) )
			  {
				  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			  }
			}
// Preferences
			if ( $ucp_mode == 'ucp_prefs' || $ucp_mode == '' )
			{
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_viewemail = $viewemail, user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_allow_viewprofile = $allowviewprofile, user_notify = $notifyreply, user_notify_pm = $notifypm, user_popup_pm = $popup_pm, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style
				WHERE user_id = $user_id";
			  if ( !($result = $db->sql_query($sql)) )
			  {
				  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			  }
			}
// Avatar
			if ( $ucp_mode == 'ucp_avatar' && $avatar_sql != '' || $ucp_mode == '' && $avatar_sql != '' )
			{
			$sql = "UPDATE " . USERS_TABLE . "
				SET " . substr($avatar_sql,2) . "
				WHERE user_id = $user_id";
			  if ( !($result = $db->sql_query($sql)) )
			  {
				  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			  }
			}
// Signature
			if ( $ucp_mode == 'ucp_signature' || $ucp_mode == '' )
			{
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_sig_bbcode_uid = '$signature_bbcode_uid', user_sig = '" . str_replace("\'", "''", $signature) . "'
				WHERE user_id = $user_id";
			  if ( !($result = $db->sql_query($sql)) )
			  {
				  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
			  }
			}
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

				"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//				"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid("index.$phpEx") . '">')
				"META" => '<meta http-equiv="refresh" content="1;url=' . append_sid("profile.$phpEx") . '?mode=viewprofile&u=' . $userdata['user_id'] . '">')
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

			$sql = "INSERT INTO " . USERS_TABLE . "	(user_id,

#
#----------[ INLINE FIND ]------------------------------
#

, user_allow_viewonline

#
#----------[ INLINE AFTER, ADD ]------------------------
#

, user_allow_viewprofile

#
#----------[ FIND ]-------------------------------------
#

				VALUES ($user_id,

#
#----------[ INLINE FIND ]------------------------------
#

, $allowviewonline

#
#----------[ INLINE AFTER, ADD ]------------------------
#

, $allowviewprofile

#
#----------[ FIND ]-------------------------------------
#

	$allowviewonline = $userdata['user_allow_viewonline'];

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
	$allowviewprofile = $userdata['user_allow_viewprofile'];
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

		$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $userdata['user_id'] . '" />';

#
#-----[ BEFORE, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
		if ( $ucp_mode )
		{
			$s_hidden_fields .= '<input type="hidden" class="post" name="ucp_mode" value="' . $ucp_mode . '" />';
			$template->assign_vars(array(
			'UCP_CANCEL' => '&nbsp;&nbsp;<INPUT TYPE="submit" VALUE="'. $lang['Cancel'] . '" name="ucp_cancel" class="liteoption" />',)
			);
			if ( $ucp_mode !='ucp_require' )
			{
				$s_hidden_fields .= '<input type="hidden" class="post" name="email" value="' . $userdata['user_email'] . '" />';

				if ( $board_config['allow_namechange'] )
				{
					$s_hidden_fields .= '<input type="hidden" class="post" name="username" value="' . $username . '" />';
				}
			}
		}
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	if ( $mode == 'editprofile' )
	{
		$template->assign_block_vars('switch_edit_profile', array());
	}

#
#----------[ BEFORE, ADD ]------------------------------
#

// <!-- BEGIN easyUCP -->
/*

#
#----------[ FIND ]-------------------------------------
#

	if ( ($mode == 'register') || ($board_config['allow_namechange']) )
	{
		$template->assign_block_vars('switch_namechange_allowed', array());
	}
	else
	{
		$template->assign_block_vars('switch_namechange_disallowed', array());
	}

#
#----------[ AFTER, ADD ]-------------------------------
#

*/
	if ( $ucp_mode ) 
	{ 
		$template->assign_vars(array( 
			'UCP_NAV' => '&nbsp;&nbsp;<a href="' . append_sid("profile.$phpEx") . '" class="nav">' . $lang['Viewing_profile'] . '</a>&nbsp;&nbsp;' . $lang['Edit_profile']) 
		); 
	}
	if ( $ucp_mode == 'ucp_require' || $ucp_mode == '' )
	{
		$template->assign_block_vars('switch_ucp_require', array() );
		if ( $mode == 'editprofile' )
		{
			$template->assign_block_vars('switch_ucp_require.switch_edit_profile', array());
		}
		if ( ($mode == 'register') || ($board_config['allow_namechange']) )
		{
			$template->assign_block_vars('switch_ucp_require.switch_namechange_allowed', array());
		}
		else
		{
			$template->assign_block_vars('switch_ucp_require.switch_namechange_disallowed', array());
		}
         // Visual Confirmation 
         $confirm_image = ''; 
         if (!empty($board_config['enable_confirm']) && $mode == 'register') 
         { 
            $sql = 'SELECT session_id 
               FROM ' . SESSIONS_TABLE; 
            if (!($result = $db->sql_query($sql))) 
            { 
               message_die(GENERAL_ERROR, 'Could not select session data', '', __LINE__, __FILE__, $sql); 
            } 

            if ($row = $db->sql_fetchrow($result)) 
            { 
               $confirm_sql = ''; 
               do 
               { 
                  $confirm_sql .= (($confirm_sql != '') ? ', ' : '') . "'" . $row['session_id'] . "'"; 
               } 
               while ($row = $db->sql_fetchrow($result)); 
             
               $sql = 'DELETE FROM ' .  CONFIRM_TABLE . " 
                  WHERE session_id NOT IN ($confirm_sql)"; 
               if (!$db->sql_query($sql)) 
               { 
                  message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql); 
               } 
            } 
            $db->sql_freeresult($result); 

            $sql = 'SELECT COUNT(session_id) AS attempts 
               FROM ' . CONFIRM_TABLE . " 
               WHERE session_id = '" . $userdata['session_id'] . "'"; 
            if (!($result = $db->sql_query($sql))) 
            { 
               message_die(GENERAL_ERROR, 'Could not obtain confirm code count', '', __LINE__, __FILE__, $sql); 
            } 

            if ($row = $db->sql_fetchrow($result)) 
            { 
               if ($row['attempts'] > 3) 
               { 
                  message_die(GENERAL_MESSAGE, $lang['Too_many_registers']); 
               } 
            } 
            $db->sql_freeresult($result); 
             
            $confirm_chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',  'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9'); 

            list($usec, $sec) = explode(' ', microtime()); 
            mt_srand($sec * $usec); 

            $max_chars = count($confirm_chars) - 1; 
            $code = ''; 
            for ($i = 0; $i < 6; $i++) 
            { 
               $code .= $confirm_chars[mt_rand(0, $max_chars)]; 
            } 

            $confirm_id = md5(uniqid($user_ip)); 

            $sql = 'INSERT INTO ' . CONFIRM_TABLE . " (confirm_id, session_id, code) 
               VALUES ('$confirm_id', '". $userdata['session_id'] . "', '$code')"; 
            if (!$db->sql_query($sql)) 
            { 
               message_die(GENERAL_ERROR, 'Could not insert new confirm code information', '', __LINE__, __FILE__, $sql); 
            } 

            unset($code); 
             
            $confirm_image = (@extension_loaded('zlib')) ? '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id") . '" alt="" title="" />' : '<img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=1") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=2") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=3") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=4") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=5") . '" alt="" title="" /><img src="' . append_sid("profile.$phpEx?mode=confirm&amp;id=$confirm_id&amp;c=6") . '" alt="" title="" />'; 
            $s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />'; 

            $template->assign_block_vars('switch_ucp_require.switch_confirm', array()); 
         } 
	}
	if ( $ucp_mode == 'ucp_info' || $ucp_mode == '' )
	{
		$template->assign_block_vars('switch_ucp_info', array() );
	}
	if ( $ucp_mode == 'ucp_prefs' || $ucp_mode == '' )
	{
		$template->assign_block_vars('switch_ucp_prefs', array() );
	}
	if ( $ucp_mode == 'ucp_signature' || $ucp_mode == '' )
	{
		$template->assign_block_vars('switch_ucp_signature', array() );
	}
	if ( $ucp_mode == '' )
	{
		$template->assign_block_vars('switch_ucp_cut', array() );
	}
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

	// Visual Confirmation
	$confirm_image = '';
	if (!empty($board_config['enable_confirm']) && $mode == 'register')

#
#----------[ BEFORE, ADD ]------------------------------
#

/*

#
#----------[ FIND ]-------------------------------------
#

		$template->assign_block_vars('switch_confirm', array());
	}

#
#----------[ AFTER, ADD ]-------------------------------
#

*/



#
#----------[ FIND ]-------------------------------------
#

		'HIDE_USER_NO' => ( $allowviewonline ) ? 'checked="checked"' : '',

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
		'HIDE_PROFILE_YES' => ( !$allowviewprofile ) ? 'checked="checked"' : '',
		'HIDE_PROFILE_NO' => ( $allowviewprofile ) ? 'checked="checked"' : '',
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

		'L_HIDE_USER' => $lang['Hide_user'],

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
		'L_HIDE_PROFILE' => $lang['Hide_profile'],
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	//
	// This is another cheat using the block_var capability
	// of the templates to 'fake' an IF...ELSE...ENDIF solution
	// it works well :)
	//
	if ( $mode != 'register' )

#
#-----[ INLINE FIND ]--------------------------------------------------
#

	if ( $mode != 'register' )

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//	if ( $mode != 'register' )
	if ( $mode != 'register' && $ucp_mode == '' || $mode != 'register' && $ucp_mode == 'ucp_avatar' )
// <!-- END easyUCP -->


#
#-----[ OPEN ]--------------------------------------------------
#

includes/usercp_viewprofile.php

#
#----------[ FIND ]-------------------------------------
#

$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
if ( !$userdata['session_logged_in']  && $profiledata['user_allow_viewprofile'] ) 
{ 
      redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&".POST_USERS_URL."=".$profiledata['user_id'], true));
      exit; 
}
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	'body' => 'profile_view_body.tpl'

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//	'body' => 'profile_view_body.tpl')
	'body' => 'easyucp_body.tpl')
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

$msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : '&nbsp;';
$msn = $msn_img;

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
//$msn_img = ( $profiledata['user_msnm'] ) ? $profiledata['user_msnm'] : '&nbsp;';
//$msn = $msn_img;
$msn_img = ( $profiledata['user_msnm'] ) ? '<img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '&nbsp;=&nbsp; ' . $profiledata['user_msnm'] . '" title="' . $lang['MSNM'] . '&nbsp;=&nbsp;' . $profiledata['user_msnm'] . '" border="0" />' : ''; 
$msn = $msn_img;
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

// Profile Sig

#
#-----[ BEFORE, ADD]--------------------------------------------
#

/*

#
#-----[ FIND ]--------------------------------------------------

$user_sig = str_replace("\n", "\n<br />\n", $user_sig);
	    $template->assign_block_vars('switch_user_sig_block', array());
    }
}

#
#-----[ AFTER, ADD]---------------------------------------------

*/

#
#-----[ FIND ]--------------------------------------------------
#

$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $profiledata['username']) . '</a>';

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
// Profile Sig
$user_sig = '';
if ( $profiledata['user_attachsig'] && $board_config['allow_sig'] )
{
    include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
    $user_sig = $profiledata['user_sig'];
    $user_sig_bbcode_uid = $profiledata['user_sig_bbcode_uid'];
	if ( $user_sig != '' )
    {
        if ( !$board_config['allow_html'] && $profiledata['user_allowhtml'] )
       	{
       		$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
       	}
    	if ( $board_config['allow_bbcode'] && $user_sig_bbcode_uid != '' )
   		{
   			$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
   		}
   		$user_sig = make_clickable($user_sig);

        if (!$userdata['user_allowswearywords'])
        {
            $orig_word = array();
            $replacement_word = array();
            obtain_word_list($orig_word, $replacement_word);
            $user_sig = preg_replace($orig_word, $replacement_word, $user_sig);
        }
        if ( $profiledata['user_allowsmile'] )
        {
            $user_sig = smilies_pass($user_sig);
        }
        $user_sig = str_replace("\n", "\n<br />\n", $user_sig);
	    $template->assign_block_vars('switch_user_sig_block', array());
    }
}
$usergroups = '';
$groups = array();
$sql = 'SELECT g.group_id, g.group_name, g.group_description, g.group_type 
	FROM '.USER_GROUP_TABLE.' as l, '.GROUPS_TABLE.' as g 
	WHERE l.user_pending = 0 AND g.group_single_user = 0 AND l.user_id =' . $profiledata['user_id'] . ' AND g.group_id = l.group_id 
	ORDER BY g.group_name, g.group_id';

if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not read groups', '', __LINE__, __FILE__, $sql);	
while ($group = $db->sql_fetchrow($result)) $groups[] = $group;

if (count($groups) > 0)
{
	$template->assign_block_vars("switch_usergroups", array());

	for ($i=0; $i < count($groups); $i++)
	{
		( (($groups[$i]['group_type'] != GROUP_HIDDEN) || ($userdata['user_level'] == ADMIN)) ? $is_ok = true : $is_ok = false );
		if (!$is_ok)
		{
			$group_id = $groups[$i]['group_id'];
			$sql = 'SELECT *
				FROM '.USER_GROUP_TABLE.'
				WHERE group_id=' . $group_id . ' AND user_id=' . $userdata['user_id'] . ' AND user_pending=0';

			if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Couldn\'t obtain viewer group list', '', __LINE__, __FILE__, $sql);
			$is_ok = ( $group = $db->sql_fetchrow($result) );
		}

		( $is_ok ? $usergroups .= '<a href = "' . append_sid("groupcp.php?g=".$groups[$i]['group_id']) . '" alt = "' . $groups[$i]['group_description'] . '" title = "' . $groups[$i]['group_description'] . '">' . $groups[$i]['group_name'] . '</a>' : '');

		( $i < (count($groups) -1) ? $usergroups .= ', ' : '');
	}
}

$sql = "SELECT post_time
	FROM " . POSTS_TABLE . "
	WHERE poster_id = " . $profiledata['user_id'] . "
	ORDER BY post_time DESC
	LIMIT 1";

if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Error getting user last post time', '', __LINE__, __FILE__, $sql);

$last_post_row = $db->sql_fetchrow($result);
$last_post_time = ( isset($last_post_row['post_time']) ) ? create_date($board_config['default_dateformat'], $last_post_row['post_time'], $board_config['board_timezone'] ) : $lang['no_post'];
( isset($last_post_row['post_time']) ) ? $template->assign_block_vars('switch_postings', array()) : '';

$last_visit_time = ($profiledata['user_session_time']) ? create_date($lang['DATE_FORMAT'], $profiledata['user_session_time'], $board_config['board_timezone']) : $lang['never_visited'];
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

//
// Generate page
//

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
	if($userdata['user_level'] == ADMIN && $userdata['user_id'] != $profiledata['user_id'] )
	{
		$template->assign_block_vars("switch_admin_userprofile", array());
	}
	if($userdata['user_id'] === $profiledata['user_id'] )
	{
		$template->assign_block_vars("switch_own_profile", array());

		if ( $board_config['allow_sig'] )
		{
			$template->assign_block_vars('switch_own_profile.switch_signature_button', array() );
		}
		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
		{
			$template->assign_block_vars('switch_own_profile.switch_avatar_button', array() );
		}
	}
// <!-- END easyUCP -->

#
#----------[ FIND ]-------------------------------------
#

$template->assign_vars(array(

#
#----------[ AFTER, ADD ]-------------------------------
#

// <!-- BEGIN easyUCP -->
	'EASY_UCP' => $lang['easyUCP'],
	'LAST_VISIT' => $last_visit_time,
	'LAST_POST_TIME' => $last_post_time,
	'PROFIL_CONTROL' => $lang['easyUCP_profil_control'],
	'EXTENSION_CONTROL' => $lang['easyUCP_extension_control'],
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	'INTERESTS' => ( $profiledata['user_interests'] ) ? $profiledata['user_interests'] : '&nbsp;',

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
	'USER_SIG' => $user_sig,
	'USERGROUPS' => $usergroups,
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	'L_VIEWING_PROFILE' => sprintf($lang['Viewing_user_profile'], $profiledata['username']),

#
#-----[ BEFORE, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
	'L_PROFILE_ADMIN' => sprintf($lang['Profile_Admin'], $profiledata['username']),
	'L_REGISTRATION_INFO' => $lang['Registration_info'],
	'L_PROFILE_INFO' => $lang['Profile_info'],
	'L_PREFERENCES' => $lang['Preferences'],
	'L_SIGNATURE' => $lang['Signature'],
	'L_PROFILE' => strtok($lang['Viewing_user_profile'], ":"), 
	'L_USER' => $profiledata['username'],
	'L_USERGROUPS' => $lang['Usergroups'],
	'L_LAST_VISIT' => $lang['last_visit'],
	'L_LAST_POST' => $lang['Last_Post'],
// <!-- END easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	'U_SEARCH_USER' => append_sid("search.$phpEx?show_results=posts&amp;search_author=" . $u_search_author),

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

// <!-- BEGIN easyUCP -->
	'U_VIEWING_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&u=" . $profiledata['user_id']),
	'U_PROFILE_ADMIN' => append_sid("admin/admin_users.$phpEx?mode=edit&amp;u=" . $profiledata['user_id'] . '&amp;sid='.$userdata['session_id']),

	'S_UCP_ACTION' => append_sid("profile.php?mode=editprofile&u=" . $profiledata['user_id']),
// <!-- END easyUCP -->

#
#-----[ OPEN ]--------------------------------------------------
#

templates/cback/profile_add_body.tpl

# 
#----------[ FIND ]------------------------------------- 
# 

      <td class="nav"><a href="{U_INDEX}">{L_INDEX}</a> &raquo; {L_PROFILE_INFO}</td> 

# 
#----------[ INLINE FIND ]------------------------------ 
# 

{L_INDEX}</a> 

# 
#----------[ INLINE AFTER, ADD ]------------------------ 
# 

{UCP_NAV} 

#
#-----[ FIND ]--------------------------------------------------
#

<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- BEGIN switch_ucp_require -->

#
#-----[ FIND ]--------------------------------------------------
#

	<!-- END switch_confirm -->

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- END switch_ucp_require -->
	<!-- BEGIN switch_ucp_cut -->

#
#-----[ FIND ]--------------------------------------------------
#

	<tr>
	  <td class="cat" colspan="2" height="28">&nbsp;</td>
	</tr>

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- END switch_ucp_cut -->
	<!-- BEGIN switch_ucp_info -->

#
#-----[ FIND ]--------------------------------------------------
#

	<tr>
<td class="row1"><span class="explaintitle">{L_INTERESTS}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px"  name="interests" size="25" maxlength="100" value="{INTERESTS}" />
</td>
</tr>

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- END switch_ucp_info -->
	<!-- BEGIN switch_ucp_signature -->
	<tr> 
	  <td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
	  <td class="row2"> 
		<textarea name="signature"style="width: 300px"  rows="6" cols="30" class="post">{SIGNATURE}</textarea>
	  </td>
	</tr>
	<!-- END switch_ucp_signature -->
	<!-- BEGIN switch_ucp_cut -->

#
#-----[ FIND ]--------------------------------------------------
#

	<td class="cat" colspan="2">&nbsp;</td>

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- END switch_ucp_cut -->
	<!-- BEGIN switch_ucp_prefs -->

#
#----------[ FIND ]-------------------------------------
#

<tr>
<td class="row1"><span class="explaintitle">{L_HIDE_USER}:</span></td>
<td class="row2">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="radio" name="hideonline" value="1" {HIDE_USER_YES} />&nbsp;</td>
<td>{L_YES}&nbsp;&nbsp;</td>
<td><input type="radio" name="hideonline" value="0" {HIDE_USER_NO} />&nbsp;</td>
<td>{L_NO}</td>
</tr>

#
#----------[ AFTER, ADD ]-------------------------------
#

<!-- easyUCP -->
<tr>
<td class="row1" width="38%"><span class="explaintitle">{L_HIDE_PROFILE}:</span></td>
<td class="row2" width="62%">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="radio" name="hideprofile" value="1" {HIDE_PROFILE_YES} />&nbsp;</td>
<td>{L_YES}&nbsp;&nbsp;</td>
<td><input type="radio" name="hideprofile" value="0" {HIDE_PROFILE_NO} />&nbsp;</td>
<td>{L_NO}</td>
</tr>
</table>
</td>
</tr>
<!-- easyUCP -->

#
#-----[ FIND ]--------------------------------------------------
#

	<tr>
<td class="row1"><span class="explaintitle">{L_DATE_FORMAT}:</span><br />
<span class="gensmall">{L_DATE_FORMAT_EXPLAIN}</span></td>
<td class="row2">
<input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14" class="post" />
</td>
</tr>

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

	<!-- END switch_ucp_prefs -->

#
#-----[ FIND ]--------------------------------------------------
#

	<!-- BEGIN switch_avatar_block -->
	<tr> 
	  <td class="catSides" colspan="2" height="28">&nbsp;</td>
	</tr>

#
#-----[ REPLACE WITH ]--------------------------------------------------
#

	<!-- BEGIN switch_ucp_cut -->
	<tr> 
	  <td class="cat" colspan="2" height="28">&nbsp;</td>
	</tr>
	<!-- END switch_ucp_cut -->
	<!-- BEGIN switch_avatar_block -->

#
#-----[ FIND ]--------------------------------------------------
#

		<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}
<input type="submit" name="submit" value="{L_SUBMIT}" class="mainoption" />
#
#----------[ INLINE FIND ]------------------------------
#

class="mainoption" />

#
#-----[ AFTER, ADD ]--------------------------------------------------
#

{UCP_CANCEL}

#
#----------[ OPEN ]-------------------------------------
#

admin/style/user_edit_body.tpl

#
#----------[ FIND ]-------------------------------------
#

	<th colspan="2">{L_SPECIAL}</th>

#
#----------[ BEFORE, ADD ]-------------------------------
#

<!-- easyUCP -->
	<tr> 
	  <td class="row1"><span class="gen">{L_HIDE_PROFILE}:</span></td>
	  <td class="row2"> 
		<input type="radio" name="hideprofile" value="1" {HIDE_PROFILE_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
		<input type="radio" name="hideprofile" value="0" {HIDE_PROFILE_NO} />
		<span class="gen">{L_NO}</span></td>
	</tr>
<!-- easyUCP -->

#
#-----[ OPEN ]--------------------------------------------------
#

language/lang_english/lang_main.php

#
#-----[ FIND ]--------------------------------------------------
#

//
// That's all, Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]--------------------------------------------------
#
#
#

// <!-- BEGIN easyUCP -->
$lang['easyUCP'] = '<font color="red">easy</font> User Control Panel';
$lang['easyUCP_profil_control'] = 'Profil preferences';
$lang['easyUCP_extension_control'] = 'Control panel';
$lang['Profile_Admin'] = 'User Administration for %s'; // %s is username
$lang['Hide_profile'] = 'Allow Profileview for Guests';
$lang['last_visit'] = 'Last visit';
$lang['never_visited'] = 'Never loged in!';
$lang['no_post'] = 'no postings';

// <!-- END easyUCP -->

#
#-----[ OPEN ]--------------------------------------------------
#

language/lang_german/lang_main.php

# 
#----------[ FIND ]------------------------------------- 
# 

$lang['Registration_info'] = 'Registrierungs-Informationen';

# 
#----------[ REPLACE WITH ]----------------------------- 
# 

$lang['Registration_info'] = 'Registrierungs-Daten'; 

#
#-----[ FIND ]--------------------------------------------------
#

//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]--------------------------------------------------
#
# 

// <!-- BEGIN easyUCP -->
$lang['easyUCP'] = '<font color="red">easy</font> User Control Panel';
$lang['easyUCP_profil_control'] = 'Profileinstellungen';
$lang['easyUCP_extension_control'] = 'Kontrollzentrum';
$lang['Profile_Admin'] = 'Benutzer Administration fr %s'; // %s ist der Benutzername
$lang['Hide_profile'] = 'Profilansicht fr Gste erlauben';
$lang['last_visit'] = 'Letzter Besuch';
$lang['never_visited'] = 'Noch nie eingelogt!';
$lang['no_post'] = 'keine Beitrge';


// <!-- END easyUCP -->

#
#-----[ SAVE AND CLOSE ALL FILES ]--------------------------------------------------
#
# EoM
